

import pytest
from selenium import webdriver
import time


@pytest.mark.parametrize(
    'num,search_key',
    [('1','光荣'),
     ('2','senium'),
     ('3','python')],
    ids=['case1','case2','case3']
)


def test_baidu_search(num,search_key):
    driver= webdriver.Chrome(executable_path='D:\\pythonglr\python\\driver\\chromedriver.exe')
    driver.get('https://www.baidu.com')
    driver.find_element_by_id('kw').send_keys(search_key)
    driver.find_element_by_id('kw').send_keys(search_key)
    driver.find_element_by_id('su').click()
    time.sleep(2)
    assert driver.title== search_key+'百度搜索'
    driver.quit()